<?php namespace Common\Model;
use Hdphp\Model\Model;
class Type extends Model{
	protected $table='type';
	//	自动验证
	protected $validate=array(
		array('tname','required','类型不能为空',3,3)
	);
	public function store(){
		if($this->create()){
			$tagArr=explode('|', Q('post.tname'));
			foreach($tagArr as $v){
				$this->add(['tname'=>$v]);
			}
			return TRUE;
		}
		return FALSE;
	}
	public function update(){
		if($this->create()){
			$this->save();
			return TRUE;
		}
		return FALSE;
	}
}
